/*
 * @lc app=leetcode.cn id=1880 lang=typescript
 *
 * [1880] 检查某单词是否等于两单词之和
 */

// @lc code=start
function isSumEqual(
    firstWord: string,
    secondWord: string,
    targetWord: string
): boolean {
    const calc = (a: string) =>
        parseInt(
            a
                .split("")
                .map((i) => i.charCodeAt(0) - 97)
                .join("")
        );

    return calc(firstWord) + calc(secondWord) === calc(targetWord);
}
// @lc code=end
